﻿using DryIoc;
using Minotaur.App.Core;
using Minotaur.App.Domains.Dto;
using Minotaur.App.Modules.Home;
using Minotaur.App.ViewModels;
using Prism.Ioc;
using Prism.Modularity;
using System.Windows;
using System.Windows.Controls;

namespace Minotaur.App.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            MainWindowViewModel viewModel = this.DataContext as MainWindowViewModel;
            AppDataContext.GlobalLoadingGrid = GlobalLoading;
            AppDataContext.GlobalLoadingView = this.GlobalLoadView; 
            viewModel.Initialization(this.btn_small, this.btn_Max, this, colorBackGroud,menuInfo);
             
        }

        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            MainWindowViewModel viewModel = this.DataContext as MainWindowViewModel;
            MenuInfoDto menuInfo= ((TreeView)sender).SelectedItem  as MenuInfoDto;
            viewModel.OpendMenuInfo(menuInfo);
        } 

        private void TreeView_PreviewKeyUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            MainWindowViewModel viewModel = this.DataContext as MainWindowViewModel;
            MenuInfoDto menuInfo = ((TreeView)sender).SelectedItem as MenuInfoDto;
            viewModel.OpendMenuInfo(menuInfo);
        }
    }
}
